import { post, get } from "../../../utils/request";
import utils from "../../../utils/utils";

const env = import.meta.env;
const contextPath = env.VITE_API_AUTH_CONTEXT_PATH;

const apiPortal = {
  // 以下接口登录后调用
  logout(data?: object) {
    return post(contextPath + "/portal/v1/logout", data);
  },
  validateToken(token: string) {
    return post(contextPath + "/v1/validate.token", { token });
  },
  refreshToken(token: string) {
    return post(contextPath + "/v1/refresh.token", { token });
  },
  loadMenuItem(menuCode: string) {
    return post(
      env.VITE_API_ADMIN_CONTEXT_PATH + "/portal/v1/menu.item.current.listing",
      { menuCode }
    );
  },
};

export default apiPortal;
